/**
 * 
 */
package ve.com.neometrica.inventario.impl.dao;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import ve.com.neometrica.inventario.api.dao.AuditorDao;
import ve.com.neometrica.inventario.api.model.Auditor;

/**
 * @author a.cabrera
 *
 */
public class AuditorDaoImpl extends HibernateDaoSupport  implements AuditorDao{

	@Override
	public List<Auditor> getAll() {
		return this.getHibernateTemplate().loadAll(Auditor.class);
	}
	@Override
	public Auditor getById(Integer id) {
		return this.getHibernateTemplate().load(Auditor.class, id);
	}
	@Override
	public void save(Auditor auditor) {
		if(auditor.getId()==null){
			getHibernateTemplate().save(auditor);
		}else{
			getHibernateTemplate().saveOrUpdate(auditor);
		}
		
	}
}
